<?php
  class banner 
  
   { 
   
         public $db;
         public $info;
         public $close=0;
         public $memcache;
         public $userdata;
  
    function getbannerconfig($student_info)
    {
    
    
                    $sql="select * from tb_backend_banner where deviceset=1";
              
                $arraydata=$this->db->db_set_1recordrow($sql);
              
                      if(!$arraydata['backid'])
                      {
                      
                      $arraydataset['deviceset']=1;
                      $arraydataset['bannershow']=1;
                      $arraydataset1['bannershow']=1;
                      
                      $this->db->db_set($arraydataset,'tb_backend_banner');
                      
                      
                      }else
                      {
                      

                      $arraydataset['bannershow']=intval($arraydata['bannershow']);
                      $arraydataset1['bannershow']=intval($arraydata['bannershow']);
                      }
                      
                 if($arraydataset['bannershow']==1)
                 {
                 $sql="select * from tb_banner where tb_banner.status=1 and (tb_banner.fid=0 or tb_banner.all=1) order by position asc";
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner))
                 {
                 foreach($arraydatabanner as $valuedatabanner)
                 {
                        $student_info['banner']['web']['bannerid'][]=$valuedatabanner['bannerid'];
                        $student_info['banner']['web']['img'][]=$valuedatabanner['img'];
                        $student_info['banner']['web']['imgmid'][]=$valuedatabanner['imgmid'];
                        $student_info['banner']['web']['all'][]=$valuedatabanner['all'];
                        $student_info['banner']['web']['link'][]=$valuedatabanner['link']; 
                        $student_info['banner']['web']['name'][]=$valuedatabanner['name'];
                        $student_info['banner']['web']['fid'][]=$valuedatabanner['fid'];
                        $student_info['banner']['web']['status'][]=$valuedatabanner['status'];
                        $student_info['banner']['web']['productid'][]=$valuedatabanner['productid'];
                        $student_info['banner']['web']['position'][]=$valuedatabanner['position'];
                        $student_info['banner']['web']['createdate'][]=$valuedatabanner['createdate'];
                 
                 }
                 
                 
                 } 
                 }
                 
                 
                 $sql="select * from tb_backend_banner where deviceset=3";
              
              $arraydata=$this->db->db_set_1recordrow($sql);
              
                      if(!$arraydata['backid'])
                      {
                      
                      $arraydataset['deviceset']=3;
                      $arraydataset['bannershow']=1;
                      $arraydataset3['bannershow']=1;
                      
                      $this->db->db_set($arraydataset,'tb_backend_banner');
                      
                      
                      }else
                      {
                      

                      $arraydataset['bannershow']=intval($arraydata['bannershow']);
                      $arraydataset2['bannershow']=intval($arraydata['bannershow']);
                      }
                 
                 if($arraydataset['bannershow']==1)
                 {
                 //banner cell everything
                 $sql="select * from tb_banner where tb_banner.status=3 and (tb_banner.fid=0 or tb_banner.all=1) order by position asc";
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner))
                 {
                 $student_info['bannercell']['web']=$arraydatabanner;
                 //foreach($arraydatabanner as $valuedatabanner)
//                 {
//                        $student_info['bannercell']['web']['bannerid'][]=$valuedatabanner['bannerid'];
//                        $student_info['bannercell']['web']['img'][]=$valuedatabanner['img'];
//                        $student_info['bannercell']['web']['imgmid'][]=$valuedatabanner['imgmid'];
//                        $student_info['bannercell']['web']['all'][]=$valuedatabanner['all'];
//                        $student_info['bannercell']['web']['link'][]=$valuedatabanner['link']; 
//                        $student_info['bannercell']['web']['name'][]=$valuedatabanner['name'];
//                        $student_info['bannercell']['web']['fid'][]=$valuedatabanner['fid'];
//                        $student_info['bannercell']['web']['status'][]=$valuedatabanner['status'];
//                        $student_info['bannercell']['web']['productid'][]=$valuedatabanner['productid'];
//                        $student_info['bannercell']['web']['position'][]=$valuedatabanner['position'];
//                        $student_info['bannercell']['web']['createdate'][]=$valuedatabanner['createdate'];
//                 
//                 }
                 
                 
                 } 
                 }
                 
                 
                      $sql="select * from tb_backend_banner where deviceset=4";
              
                       $arraydata=$this->db->db_set_1recordrow($sql);
              
                      if(!$arraydata['backid'])
                      {
                      
                      $arraydataset['deviceset']=4;
                      $arraydataset['bannershow']=1;
                      $arraydataset4['bannershow']=1;
                      
                      $this->db->db_set($arraydataset,'tb_backend_banner');
                      
                      
                      }else
                      {
                      

                      $arraydataset['bannershow']=intval($arraydata['bannershow']);
                      $arraydataset4['bannershow']=intval($arraydata['bannershow']);
                      }
                 if($arraydataset['bannershow']==1)
                 {
                 //iphone
                 $sql="select * from tb_banner where tb_banner.status=4 and (tb_banner.fid=0 or tb_banner.all=1) order by position asc";
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner))
                 {
                 foreach($arraydatabanner as $valuedatabanner)
                 {
                        $student_info['banner']['mobile']['bannerid'][]=$valuedatabanner['bannerid'];
                        $student_info['banner']['mobile']['img'][]=$valuedatabanner['img'];
                        $student_info['banner']['mobile']['imgmid'][]=$valuedatabanner['imgmid'];
                        $student_info['banner']['mobile']['link'][]=$valuedatabanner['link']; 
                        $student_info['banner']['mobile']['name'][]=$valuedatabanner['name'];
                        $student_info['banner']['mobile']['fid'][]=$valuedatabanner['fid'];
                        $student_info['banner']['mobile']['all'][]=$valuedatabanner['all'];
                        $student_info['banner']['mobile']['status'][]=$valuedatabanner['status'];
                        $student_info['banner']['mobile']['productid'][]=$valuedatabanner['productid'];
                        $student_info['banner']['mobile']['position'][]=$valuedatabanner['position'];
                        $student_info['banner']['mobile']['createdate'][]=$valuedatabanner['createdate'];
                 
                 }
                 
                 
                 } 
                 
                 }
                 
                 
                       $sql="select * from tb_backend_banner where deviceset=5";
              
                       $arraydata=$this->db->db_set_1recordrow($sql);
              
                      if(!$arraydata['backid'])
                      {
                      
                      $arraydataset['deviceset']=5;
                      $arraydataset['bannershow']=1;
                      $arraydataset5['bannershow']=1;
                      
                      $this->db->db_set($arraydataset,'tb_backend_banner');
                      
                      
                      }else
                      {
                      

                      $arraydataset['bannershow']=intval($arraydata['bannershow']);
                      $arraydataset5['bannershow']=intval($arraydata['bannershow']);
                      }
                 
                 if($arraydataset['bannershow']==1)
                 {
                  //ipad
                 $sql="select * from tb_banner where tb_banner.status=5 and (tb_banner.fid=0 or tb_banner.all=1) order by position asc";
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner))
                 {
                 foreach($arraydatabanner as $valuedatabanner)
                 {
                        $student_info['banner']['mobile1']['bannerid'][]=$valuedatabanner['bannerid'];
                        $student_info['banner']['mobile1']['img'][]=$valuedatabanner['img'];
                        $student_info['banner']['mobile1']['imgmid'][]=$valuedatabanner['imgmid'];
                        $student_info['banner']['mobile1']['link'][]=$valuedatabanner['link']; 
                        $student_info['banner']['mobile1']['name'][]=$valuedatabanner['name'];
                        $student_info['banner']['mobile1']['fid'][]=$valuedatabanner['fid'];
                        $student_info['banner']['mobile1']['all'][]=$valuedatabanner['all'];
                        $student_info['banner']['mobile1']['status'][]=$valuedatabanner['status'];
                        $student_info['banner']['mobile1']['productid'][]=$valuedatabanner['productid'];
                        $student_info['banner']['mobile1']['position'][]=$valuedatabanner['position'];
                        $student_info['banner']['mobile1']['createdate'][]=$valuedatabanner['createdate'];
                 
                 }
                 
                 
                 }  
                 }
                 
                 
                      $sql="select * from tb_backend_banner where deviceset=6";
              
                       $arraydata=$this->db->db_set_1recordrow($sql);
              
                      if(!$arraydata['backid'])
                      {
                      
                      $arraydataset['deviceset']=6;
                      $arraydataset['bannershow']=1;
                      $arraydataset6['bannershow']=1;
                      
                      $this->db->db_set($arraydataset,'tb_backend_banner');
                      
                      
                      }else
                      {
                      

                      $arraydataset['bannershow']=intval($arraydata['bannershow']);
                      $arraydataset6['bannershow']=intval($arraydata['bannershow']);
                      }
                 
                 if($arraydataset['bannershow']==1)
                 {
                 //android s
                 $sql="select * from tb_banner where tb_banner.status=6 and (tb_banner.fid=0 or tb_banner.all=1) order by position asc";
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner))
                 {
                 foreach($arraydatabanner as $valuedatabanner)
                 {
                        $student_info['banner']['android']['bannerid'][]=$valuedatabanner['bannerid'];
                        $student_info['banner']['android']['img'][]=$valuedatabanner['img'];
                        $student_info['banner']['android']['imgmid'][]=$valuedatabanner['imgmid'];
                        $student_info['banner']['android']['link'][]=$valuedatabanner['link']; 
                        $student_info['banner']['android']['name'][]=$valuedatabanner['name'];
                        $student_info['banner']['android']['fid'][]=$valuedatabanner['fid'];
                        $student_info['banner']['android']['all'][]=$valuedatabanner['all'];
                        $student_info['banner']['android']['status'][]=$valuedatabanner['status'];
                        $student_info['banner']['android']['productid'][]=$valuedatabanner['productid'];
                        $student_info['banner']['android']['position'][]=$valuedatabanner['position'];
                        $student_info['banner']['android']['createdate'][]=$valuedatabanner['createdate'];
                 
                 }
                 
                 
                 } 
                 
                 }
                 
                 
                       $sql="select * from tb_backend_banner where deviceset=7";
              
                       $arraydata=$this->db->db_set_1recordrow($sql);
              
                      if(!$arraydata['backid'])
                      {
                      
                      $arraydataset['deviceset']=7;
                      $arraydataset['bannershow']=1;
                      $arraydataset7['bannershow']=1;
                      
                      $this->db->db_set($arraydataset,'tb_backend_banner');
                      
                      
                      }
                      else
                      {
                      

                      $arraydataset['bannershow']=intval($arraydata['bannershow']);
                      $arraydataset7['bannershow']=intval($arraydata['bannershow']);
                      }
                      
                 if($arraydataset['bannershow']==1)
                 {
                 
                 //android m
                 $sql="select * from tb_banner where tb_banner.status=7 and (tb_banner.fid=0 or tb_banner.all=1) order by position asc";
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner))
                 {
                 foreach($arraydatabanner as $valuedatabanner)
                 {
                        $student_info['banner']['android1']['bannerid'][]=$valuedatabanner['bannerid'];
                        $student_info['banner']['android1']['img'][]=$valuedatabanner['img'];
                        $student_info['banner']['android1']['imgmid'][]=$valuedatabanner['imgmid'];
                        $student_info['banner']['android1']['link'][]=$valuedatabanner['link']; 
                        $student_info['banner']['android1']['name'][]=$valuedatabanner['name'];
                        $student_info['banner']['android1']['fid'][]=$valuedatabanner['fid'];
                        $student_info['banner']['android1']['all'][]=$valuedatabanner['all'];
                        $student_info['banner']['android1']['status'][]=$valuedatabanner['status'];
                        $student_info['banner']['android1']['productid'][]=$valuedatabanner['productid'];
                        $student_info['banner']['android1']['position'][]=$valuedatabanner['position'];
                        $student_info['banner']['android1']['createdate'][]=$valuedatabanner['createdate'];
                 
                 }
                 
                 
                 }   
                 
                 }
                 
                 
                 
                 
                 $sql="select * from tb_backend_banner where deviceset=8";
              
                       $arraydata=$this->db->db_set_1recordrow($sql);
              
                      if(!$arraydata['backid'])
                      {
                      
                      $arraydataset['deviceset']=8;
                      $arraydataset['bannershow']=1;
                      $arraydataset8['bannershow']=1;
                      
                      $this->db->db_set($arraydataset,'tb_backend_banner');
                      
                      
                      }
                      else
                      {
                      

                      $arraydataset['bannershow']=intval($arraydata['bannershow']);
                      $arraydataset8['bannershow']=intval($arraydata['bannershow']);
                      }
                      
                 if($arraydataset['bannershow']==1)
                 {
                 
                 //android L
                 $sql="select * from tb_banner where tb_banner.status=8 and (tb_banner.fid=0 or tb_banner.all=1) order by position asc";
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner))
                 {
                 foreach($arraydatabanner as $valuedatabanner)
                 {
                        $student_info['banner']['android2']['bannerid'][]=$valuedatabanner['bannerid'];
                        $student_info['banner']['android2']['img'][]=$valuedatabanner['img'];
                        $student_info['banner']['android2']['imgmid'][]=$valuedatabanner['imgmid'];
                        $student_info['banner']['android2']['link'][]=$valuedatabanner['link']; 
                        $student_info['banner']['android2']['name'][]=$valuedatabanner['name'];
                        $student_info['banner']['android2']['fid'][]=$valuedatabanner['fid'];
                        $student_info['banner']['android2']['all'][]=$valuedatabanner['all'];
                        $student_info['banner']['android2']['status'][]=$valuedatabanner['status'];
                        $student_info['banner']['android2']['productid'][]=$valuedatabanner['productid'];
                        $student_info['banner']['android2']['position'][]=$valuedatabanner['position'];
                        $student_info['banner']['android2']['createdate'][]=$valuedatabanner['createdate'];
                 
                 }
                 
                 
                 }   
                 
                 }
                 
                 
                  $sql="select * from tb_backend_banner where deviceset=2";
              
                       $arraydata=$this->db->db_set_1recordrow($sql);
              
                      if(!$arraydata['backid'])
                      {
                      
                      $arraydataset['deviceset']=2;
                      $arraydataset['bannershow']=1;
                      $arraydataset2['bannershow']=1;
                      
                      $this->db->db_set($arraydataset,'tb_backend_banner');
                      
                      
                      }
                      else
                      {
                      

                      $arraydataset['bannershow']=intval($arraydata['bannershow']);
                      $arraydataset3['bannershow']=intval($arraydata['bannershow']);
                      }
                      $student_info['bannetstatusset'][1]['bannershow']=$arraydataset1['bannershow'];
                      $student_info['bannetstatusset'][2]['bannershow']=$arraydataset2['bannershow'];  
                      $student_info['bannetstatusset'][3]['bannershow']=$arraydataset3['bannershow'];  
                      $student_info['bannetstatusset'][4]['bannershow']=$arraydataset4['bannershow'];  
                      $student_info['bannetstatusset'][5]['bannershow']=$arraydataset5['bannershow'];  
                      $student_info['bannetstatusset'][6]['bannershow']=$arraydataset6['bannershow'];  
                      $student_info['bannetstatusset'][7]['bannershow']=$arraydataset7['bannershow'];  
                      $student_info['bannetstatusset'][8]['bannershow']=$arraydataset8['bannershow'];  
                   
                       return $student_info;
    
    }
    
    function getbannerdatafeature($student_info)
    {
    
               
               $student_info['database'][]='database29-11-2556.sql';
               $student_info['database'][]='database30-10-2556.sql';
               $student_info['database'][]='database31-10-2556.sql';
               $student_info['database'][]='database01-11-2556.sql';
               $student_info['database'][]='database06-11-2556.sql';
               $student_info['database'][]='database07-11-2556.sql';
               $student_info['database'][]='database11-11-2556.sql';
               $student_info['database'][]='database14-11-2556.sql';
               $student_info['database'][]='database16-12-2556.sql';
               $student_info['database'][]='database19-12-2556.sql';
               $student_info['database'][]='database23-12-2556.sql';
               $student_info['database'][]='database09-01-2557.sql';
               $student_info['database'][]='database21-01-2557.sql';
               $student_info['database'][]='database23-01-2557.sql';
               $student_info['database'][]='database28-01-2557.sql';
               $student_info['database'][]='database30-01-2557.sql';
               $student_info['database'][]='database05-02-2557.sql';
               $student_info['database'][]='database07-02-2557.sql';
               $student_info['database'][]='database10-02-2557.sql';
               $student_info['database'][]='database13-02-2557.sql';
               $student_info['database'][]='database21-02-2557.sql';
               $student_info['database'][]='database05-03-2557.sql';
               $student_info['database'][]='database06-03-2557.sql';
               $student_info['database'][]='database17-03-2557.sql';
               $student_info['database'][]='database27-03-2557.sql';
               $student_info['database'][]='database10-04-2557.sql';
               $student_info['database'][]='database15-04-2557.sql';
               $student_info['database'][]='database22-04-2557.sql';
               $student_info['database'][]='database24-04-2557.sql';
               $student_info['database'][]='database25-04-2557.sql';
               $student_info['database'][]='database02-05-2557.sql';
               $student_info['database'][]='database21-05-2557.sql';
               $student_info['database'][]='database27-05-2557.sql';
               $student_info['database'][]='database13-06-2557.sql';
               $student_info['database'][]='database16-07-2557.sql';
               $student_info['database'][]='database17-07-2557.sql';
               $student_info['database'][]='database04-08-2557.sql';
               $student_info['database'][]='database07-08-2557.sql';
               $student_info['database'][]='database26-08-2557.sql';
               $student_info['database'][]='database11-09-2557.sql';
               $student_info['database'][]='database16-09-2557.sql';
               $student_info['database'][]='database08-10-2557.sql';
               $student_info['database'][]='database15-10-2557.sql';
               $student_info['database'][]='database16-10-2557.sql';
               $student_info['database'][]='database10-11-2557.sql';
               $student_info['database'][]='database11-12-2557.sql';
               $student_info['database'][]='database27-01-2558.sql';
               
               
               
               
               
               
               if($_GET['dmname'])
               {
               
               $student_info['dmname']=$_GET['dmname'];
               
               }
               
               
               if(isset($_GET['systemopen']))
               {
               
               $student_info['systemopen']=$_GET['systemopen'];
               
               }
               
               
               
               

    
               if(isset($this->info['configall']['database'])&&count($this->info['configall']['database']))
               {
               
                   foreach($student_info['database'] as $valuedatabase)
                   {
                   
                     if(in_array($valuedatabase,$this->info['configall']['database']))
                     {
                     
                     
                     }else
                     {
                    //  echo "test";
                      $mysqlImportFilename=rootpath.'/sql/'.$valuedatabase;
                      if(is_file($mysqlImportFilename))
                      {
                      $command='mysql -h' .db_host .' -u' .db_user .' -p' .escapeshellarg(db_pass) .' ' .db_name .' < ' .$mysqlImportFilename;
                      //echo $command;
                      exec($command,$output=array(),$worked); 
                      }
                         
                     
                     }
                   
                   
                   }
                   
               
                   
               
               
               }else
               {
               
                   
                   
                   
                   if(count($student_info['database']))
                   {
                   foreach($student_info['database'] as $valuedatabase)
                   {
                   
                       $mysqlImportFilename=rootpath.'/sql/'.$valuedatabase;
                       if(is_file($mysqlImportFilename))
                      {
                      $command='mysql -h' .db_host .' -u' .db_user .' -p' .escapeshellarg(db_pass) .' ' .db_name .' < ' .$mysqlImportFilename;
                      //echo $command;
                      exec($command,$output=array(),$worked);
                      }
                      
//                      switch($worked){
//    case 0:
       // echo 'Import file <b>' .$mysqlImportFilename .'</b> successfully imported to database <b>' .$mysqlDatabaseName .'</b>';
//        break;
//    case 1:
      //  echo 'There was an error during import. Please make sure the import file is saved in the same folder as this script and check your values:<br/><br/><table><tr><td>MySQL Database Name:</td><td><b>' .$mysqlDatabaseName .'</b></td></tr><tr><td>MySQL User Name:</td><td><b>' .$mysqlUserName .'</b></td></tr><tr><td>MySQL Password:</td><td><b>NOTSHOWN</b></td></tr><tr><td>MySQL Host Name:</td><td><b>' .$mysqlHostName .'</b></td></tr><tr><td>MySQL Import Filename:</td><td><b>' .$mysqlImportFilename .'</b></td></tr></table>';
//        break;
//}

//exit;
                   
                      // $path=rootpath.'/sql/database29-11-2556.sql';
                       //$sql=file_get_contents($path);
                       
                       // $this->db->db_set_execute($sql);
                   
                   
                   
                   }
                   
                   }
                   
                   
                   
                  // $student_info['lastupdate']='database29-11-2556.sql';
               
               
               }
                
                $sql='select * from tb_feature order by position asc';
                $featuredata=$this->db->db_set_recordset($sql);
                $k=0;
                if(count($featuredata))
                {
                
                
                
                foreach($featuredata as $valuedata2)
                {
                $dataset=array();
                
                $dataset=json_decode($valuedata2['config']);
                $dataarray=object_to_array($dataset);
                
                
                
                
                
                
                $sql='select * from tb_feature_plugin where fid='.$valuedata2['fid'];
                $featuredata2=$this->db->db_set_recordset($sql);
                
                
                if(count($featuredata2))
                {
                $x=0;
                foreach($featuredata2 as $valuedata3)
                
                {
                $dataset2=array();
                $dataset2=json_decode($valuedata3['config']);
                $dataarray3=object_to_array($dataset2);
                $dataarray['plugins'][$x]=$dataarray3;
                
                $x++;
                
               // $dataarray['config']=;
                }
                
                }
                
                
                
                $student_info['feature'][$k]=$dataarray;
                
                
                
               // echo "<pre>";
//                print_r($dataarray);
//                echo "</pre>;";
//                exit;
                
                $k++;
                
                
                }
                
                
                
                }
                
                
           
                
                // $featuredata=$this->db->db_set_1recordrow($sql);
                 
               if(count($student_info['feature']))
                 {
                 $sql='';
                 $k=0;
                 $rowdata=1;
                 
                 
                 foreach($student_info['feature'] as $valuefeature)
                 {
                 if($valuefeature['fid'])
                 {
                 
                 
                 
                 
                 
                 if($featuredata[0]['fsid'])
                 {

                 
                 
                 
                 }else
                 {
                 
                 
                 $arraydata2=array();
                 $arraydata2['fid']=$valuefeature['fid'];
                 $arraydata2['name']=$valuefeature['name'];
                 $arraydata2['link']=$valuefeature['link'];
                 $arraydata2['roleid']=$valuefeature['roleid'];
                 $arraydata2['show']=$valuefeature['show'];
                 $arraydata2['showadd']=$valuefeature['showadd'];
                 $arraydata2['config']=json_encode($valuefeature);
                 $arraydata2['position']=$rowdata;
                 $rowdata++;
                 
                 $this->db->db_set($arraydata2,'tb_feature');
                 
                 
                 if(count($valuefeature['plugins'])&&isset($valuefeature['plugins']))
                 {
                 foreach($valuefeature['plugins'] as $valueplugins)
                 {
                 
                 $arraydata2=array();
                 $arraydata2['fid']=$valuefeature['fid'];
                 $arraydata2['plugid']=$valueplugins['plugid'];
                 $arraydata2['config']=json_encode($valueplugins);
                 $this->db->db_set($arraydata2,'tb_feature_plugin');
                 
                 
                 
                 
                 }
                 
                 
                 }
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 }
                 
                 
                 
                 $sql="select * from tb_banner where tb_banner.status=3 and (tb_banner.fid=".$valuefeature['fid'].' or tb_banner.all=1)  order by position asc';
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner)&&$student_info['bannetstatusset'][3]['bannershow']==1)
                 {
                 
                        $student_info['feature'][$k]['bannercell']['web']=$arraydatabanner;
                         
                 }
                 else
                 {
                            unset($student_info['feature'][$k]['bannercell']);
                 
                 }
                 
                 
                 $sql="select * from tb_banner where tb_banner.status=1 and (tb_banner.fid=".$valuefeature['fid'].' or tb_banner.all=1) order by position asc';
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 
                 
                 if(count($arraydatabanner)&&$student_info['bannetstatusset'][1]['bannershow']==1)
                 {
                 
                            $student_info['feature'][$k]['bannermain']['web']=$arraydatabanner;
                         
                 }
                 else
                 {
                            unset($student_info['feature'][$k]['bannermain']['web']);
                 
                 }
                 
                 
                 
                 $sql="select * from tb_banner where tb_banner.status=4 and (tb_banner.fid=".$valuefeature['fid'].' or tb_banner.all=1) order by position asc';
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 
                 
                 if(count($arraydatabanner)&&$student_info['bannetstatusset'][4]['bannershow']==1)
                 {
                 
                        $student_info['feature'][$k]['bannermain']['iphone']=$arraydatabanner;
                         
                 }
                 else
                 {
                            unset($student_info['feature'][$k]['bannermain']['iphone']);
                 
                 }
                 
                 
                 $sql="select * from tb_banner where tb_banner.status=5 and (tb_banner.fid=".$valuefeature['fid'].' or tb_banner.all=1) order by position asc';
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 
                 
                 if(count($arraydatabanner)&&$student_info['bannetstatusset'][5]['bannershow']==1)
                 {
                 
                        $student_info['feature'][$k]['bannermain']['ipad']=$arraydatabanner;
                         
                 }
                 else
                 {
                            unset($student_info['feature'][$k]['bannermain']['ipad']);
                 
                 }
                 
                 
                 $sql="select * from tb_banner where tb_banner.status=6 and (tb_banner.fid=".$valuefeature['fid'].' or tb_banner.all=1) order by position asc';
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 
                 
                 if(count($arraydatabanner)&&$student_info['bannetstatusset'][6]['bannershow']==1)
                 {
                 
                        $student_info['feature'][$k]['bannermain']['androids']=$arraydatabanner;
                         
                 }
                 else
                 {
                            unset($student_info['feature'][$k]['bannermain']['androids']);
                 
                 }
                 
                 
                 $sql="select * from tb_banner where tb_banner.status=7 and (tb_banner.fid=".$valuefeature['fid'].' or tb_banner.all=1) order by position asc';
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 
                 
                 if(count($arraydatabanner)&&$student_info['bannetstatusset'][7]['bannershow']==1)
                 {
                 
                        $student_info['feature'][$k]['bannermain']['androidm']=$arraydatabanner;
                         
                 }
                 else
                 {
                            unset($student_info['feature'][$k]['bannermain']['androidm']);
                 
                 }
                 
                 $sql="select * from tb_banner where tb_banner.status=8 and (tb_banner.fid=".$valuefeature['fid'].' or tb_banner.all=1) order by position asc';
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 
                 
                 if(count($arraydatabanner)&&$student_info['bannetstatusset'][8]['bannershow']==1)
                 {
                 
                        $student_info['feature'][$k]['bannermain']['androidl']=$arraydatabanner;
                         
                 }
                 else
                 {
                            unset($student_info['feature'][$k]['bannermain']['androidl']);
                 
                 }
                 
                 
                 
                 
                 $sql="select * from tb_banner where tb_banner.status=2 and (tb_banner.fid=".$valuefeature['fid'].' or tb_banner.all=1)  order by position asc';;
                 $arraydatabanner=$this->db->db_set_recordset($sql);
                 if(count($arraydatabanner)&&$student_info['bannetstatusset'][2]['bannershow']==1)
                 {
                 
                        $student_info['feature'][$k]['bannerlanding']['web']=$arraydatabanner;
                         
                 }
                 else
                 {
                            unset($student_info['feature'][$k]['bannerlanding']);
                 
                 }
                 
                 
                 
                 }
                 $k++; 
                 }
                 
                 }
                 
                 
                 
                 
                 
                 $sql="SHOW TABLES LIKE 'tb_share_stat'";
                 $arraycheck=$this->db->db_set_1recordrow($sql);
                 if(count($arraycheck)==0)
                 {
                 
                         $sql='CREATE TABLE `tb_share_stat` (
  `shareid` int(11) NOT NULL AUTO_INCREMENT,
  `caseid` int(11) NOT NULL,
  `productid` int(11) NOT NULL,
  `ip` int(11) NOT NULL,
  `agent` int(11) NOT NULL,
  `createby` int(11) NOT NULL,
  `createdate` datetime NOT NULL,
  PRIMARY KEY (`shareid`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8';

                        $this->db->db_set_execute($sql);
                 
                 }
                 
                 $sql="SHOW TABLES LIKE 'tb_serial'";
                 $arraycheck=$this->db->db_set_1recordrow($sql);
                 if(count($arraycheck)==0)
                 {
                 $sql='
CREATE TABLE `tb_serial` (
  `serialid` int(11) NOT NULL AUTO_INCREMENT,
  `serial` varchar(200) NOT NULL,
  `createby` int(11) NOT NULL,
  `createdate` datetime NOT NULL,
  PRIMARY KEY (`serialid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8';
$this->db->db_set_execute($sql);
                 }
                 
                 
     //              echo "<pre>";
//                   print_r($student_info);
//                   echo "</pre>;";
//                   exit;
    
                 return $student_info;
    }
  
  
  }
?>
